<!-- 图标设置 -->
<template>
  <div class="">
    <a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
      <a-row>
        <a-col :span="8">
          <a-form-model-item label="网站LOGO" labelAlign="left">
            <UploadImg v-model="form.logoUrl" warehouse />
          </a-form-model-item>
        </a-col>
        <a-col :span="8">
          <a-form-model-item label="网站分享封面" labelAlign="left">
            <UploadImg v-model="form.shareImgUrl" warehouse cropper />
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :span="8">
          <a-form-model-item label="浏览器图标" labelAlign="left">
            <UploadImg v-model="form.iconUrl" warehouse cropper />
          </a-form-model-item>
        </a-col>
        <!-- <a-col :span="8">
          <a-form-model-item label="公众号二维码" labelAlign="left" extra="官网展示的公众号二维码">
            <UploadImg v-model="form.wxQrcodeUrl" warehouse cropper :width="125" :height="125" :cropperEnlarge="4" />
          </a-form-model-item>
        </a-col> -->
      </a-row>
      <a-form-model-item v-has="'web:webSite:edit'" :wrapper-col="{ span: 14, offset: 4 }">
        <a-button type="primary" style="margin-left: 10px" @click="onSubmit">保存</a-button>
      </a-form-model-item>
    </a-form-model>
  </div>
</template>

<script>
import { setConfigWebsite } from '@/api/web/web'
import UploadImg from '@/components/UpFile/uploadImg'

export default {
  components: {
    UploadImg
  },
  data() {
    return {
      labelCol: { span: 6 },
      wrapperCol: { span: 18 },
      loading: false,
      form: {
        logoUrl: undefined,
        shareImgUrl: undefined,
        iconUrl: undefined,
        // wxQrcodeUrl: undefined,
      }
    }
  },
  computed: {},
  watch: {},
  methods: {
    setImage(data) {
      console.log('data---->', data)
      Object.keys(this.form).forEach(k => {
        this.form[k] = data[k]
      })
    },
    async onSubmit() {
      let { code, msg } = await setConfigWebsite(this.form)
      this.$message[code === 0 ? 'success' : 'error'](msg)
      if (code === 0) {
        this.$emit('update')
      }
    },
    resetForm() {}
  },
  created() {},
  mounted() {}
}
</script>
<style scoped></style>
